'use strict';

const Controller = require('egg').Controller;

class UserController extends Controller {
  //登录
  async login() {
    const { password, username } = this.ctx.request.body;
    const data = await this.ctx.service.user.login({ password, username });
    this.ctx.body = data;
  }
  //获取用户数据
  async getUser(){
    const query = this.ctx.query;
    const data = await this.ctx.service.user.getUser(query);
    this.ctx.body = data;
  }
  //模糊搜索
  async getVague(){
    const query = this.ctx.query.vague;
    const data = await this.ctx.service.user.getVague(query);
    this.ctx.body = data;
  }
  //添加用户获取项目、角色、班级列表
  async gitCreateUser(){
    const data = await this.ctx.service.user.gitCreateUser();
    this.ctx.body = data;
  }
  async gitCreateClass(){
    const data = await this.ctx.service.user.gitCreateClass();
    this.ctx.body = data;
  }
  //添加用户
  async createUser() {
    const data = await this.ctx.service.user.createUser()
    this.ctx.body = data;
  }
}

module.exports = UserController;
